<div class="container">
    <?php foreach ($cpFunctionGroups as $group) { ?>
        <?php
        $flag = false;
        foreach ($cpFunctions as $func) {
            if ($func->type == 1 && $func->groupId == $group->id && in_array($func->id, $this->session->administratorRole)) {
                $flag = true;
                break;
            }
        }
        ?>   
        <?php if ($flag) { ?>
            <div class="col-sm-4" >
                <div class="panel panel-<?= (strlen($group->name) < 10) ? 'success' : strlen($group->name) < 13 ? 'danger' : 'warning' ?>" >
                    <h4 class="panel-heading" style="margin-top: 0px;" ><?= $group->name ?></h4>
                    <ul class="list-group" style="overflow-y: auto; margin-left: 10px; height: 150px;" >
                        <?php foreach ($cpFunctions as $func) { ?>
                            <?php if ($func->type == 1 && $func->groupId == $group->id && in_array($func->id, $this->session->administratorRole)) { ?>
                                <li class="list-group-item" >
                                    <a class="text-<?= (strlen($group->name) < 10) ? 'success' : strlen($group->name) < 13 ? 'danger' : 'warning' ?>"" href="<?= $this->baseUrl . $func->uri ?>"><?= $func->name ?></a>
                                </li>
                            <?php } ?>
                        <?php } ?>
                    </ul>
                </div>
            </div>
        <?php } ?>
    <?php } ?>
</div>